package com.itheima.demo5;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class IODemo4 {
    public static void main(String[] args) throws IOException {
        //创建对象
        FileInputStream fio = new FileInputStream("image/girl/girl1/all.jpg");
        FileOutputStream fos = new FileOutputStream("a.txt");

        //创建一个数组进行一次读取多个数据
        int len ;
        byte[] bytes = new byte[1024*1024*5];

        //拷贝
/*        int b ;
        while ((b = fio.read(bytes) ) != 0 ){
            fos.write(b);
        }
 */
        while ((len = fio.read()) != -1){
            fos.write(bytes,0,len);
        }


        //关闭流，先开后关
        fos.close();
        fio.close();
    }
}
